package com.teemo.dp.flyweight.demo1;

import java.util.ArrayList;
import java.util.List;

/**
 * @author Teemo
 */
public class Demo {
    public static void main(String[] args) {
        List<Piece> pieces = new ArrayList<>();
        for (int i = 0; i < 10; i++) {
            Piece piece;
            if (i % 2 == 0) {
                piece = new Piece("black");
            } else {
                piece = new Piece("white");
            }
            piece.setX(i);
            piece.setY(i);
            pieces.add(piece);
        }
        System.out.println(pieces.size());
        pieces.forEach(System.out::println);
    }
}
